<template>
  <div class="house_modal">
    <div class="house_modal_content">
      <div class="title">修改状态</div>
      <div>
        <div class="content">
          <span>状态</span>
          <el-select v-model="status" placeholder="请选择">
            <el-option
              v-for="(item,index) in statusSelect"
              :key="item.id"
              :label="item.title"
              :value="item.id">
            </el-option>
          </el-select>
        </div>
        <div class="button">
          <el-button type="warning" size="small" @click="closeModal" plain>取消</el-button>
          <el-button type="success" @click="modifyHouseFunc" size="small" >保存</el-button>
        </div>
      </div>
    </div>
  </div>
</template>
<script type="text/babel">
  export default {
    name:'HouseModal',
    props: {
      houseID:{
        type:Number
      },
      closeModifyHouse:{
        type: Function
      },
      LDmodal:{
        type:Function
      },
      getBuildHouse:{
        type:Function
      }
    },
    data() {
      return {
        statusSelect: [
          {id:1,title:'正常'},
          {id:2,title:'推荐'},
          {id:3,title:'急售'},
          {id:4,title:'暂不售'},
          {id:5,title:'成交'},
          {id:6,title:'无效'},
        ],
        status:''
      }
    },
    methods:{
      // 、、修改方法
      modifyHouseFunc(){
        let that = this;
        that.$http.post('/index/house/edit/' + that.houseID,{
            // id:that.houseID,
            status:that.status
        })
          .then(res=>{
            console.log(res);
            if (res.data.status === 1){
              that.closeModal();
              that.getBuildHouse();
              that.$store.state.messageString = res.data.msg;
              that.LDmodal();
            } else{
              that.$store.state.messageString = res.data.msg;
              that.LDmodal();
            }

        })
      },
      //关闭弹窗
      closeModal(){
        this.closeModifyHouse();
        this.status = '';
      }
    }

  }
</script>
<style scoped>
.house_modal{
  background-color: #000000;
  /*opacity: 0.5;*/
  width: 100%;
  height: 100%;
  z-index: 9999999;
  position: absolute;
  left: 0;
  top: 0;
}
.house_modal_content{
  width: 30%;
  position: relative;
  background-color: #ffffff;
  color: #000000 !important;
  left: 35%;
  top: 30%;
  padding: 20px;
}
.house_modal_content .title{
  font-size: 1.2rem;
}
.house_modal_content .content{
  margin: 10px 0;
}
.house_modal_content .content span{
    margin-right: 20px;
  }
.house_modal_content .button{
    display: flex;
  justify-content: space-between;
  }
</style>
